package com.glx.test.controller;

import com.glx.test.response.RegisterResponse;
import com.glx.test.service.MailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
@RequestMapping("/mail")
public class MailController {
    @Autowired
    private MailService mailService;

    @GetMapping("/getRegisterCode")
    public RegisterResponse getRegisterCode(@RequestParam("mail") String mail){
       return mailService.registerEmail(mail);
    }

    @GetMapping("/verifyRegisterCode")
    public RegisterResponse verifyRegisterCode(@RequestParam("mail") String mail,
                                         @RequestParam("code") String code){
        return mailService.verifyRegisterCode(mail,code);
    }
}
